<style type="text/css">
  .discontent{padding-left:20px;}
  .discontent a{color:fuchsia;}
  .item div{border-top:solid 1px #eee;padding:4px;}
  .item div table{width:100%;}
</style>
<script type="text/javascript">
  $(document).ready(function(){
    $(".item div").hide();
    $("a[ref=dis]").toggle(function(){
      $(this).html("\u9690藏内容").closest("td").children("div").show();
    },function(){
      $(this).html("\u663e示内容").closest("td").children("div").hide();
    });
  });
</script>
<h3>留言管理</h3>
<table>
  <tr>
    <th >标题</th>
    <th>留言人</th>
    <th>回复条数</th>
    <th>时间</th>
    <th>&nbsp;</th>
  </tr>
  <% for item in @reviews -%>
    <tr class="item" id="review<%=item.id %>">
      <td><%= h item.title %><span class="discontent"><a href="#" ref="dis" >显示内容</a></span>
        <div><%= h item.content %></div>
        <div id="div<%=item.id %>">
        <%=link_to_remote "显示回复",:url=>review_comments_path(item.id),:method=>:get,:update=>"div#{item.id}" %></div>
      </td>
      <td><%= h item.login %> </td>
      <td id="review_count<%=item.id %>"><%= item.comments_count %> </td>
      <td><%= item.created_at.to_s(:db) %> </td>
      <td><%= link_to_remote '删除', :url=>review_path(item), :confirm => 'Are you sure?', :method => :delete %></td>
    </tr>
  <% end -%>
</table>


